package cn.com.zcode.user.model;

import cn.com.zcode.core.model.BaseModelSupport;

/**
 * 
 * @author ZENGJQ
 * @since 2013-5-25
 */
public class User extends BaseModelSupport {
	private static final long serialVersionUID = 1L;
	public static final String SESSION_USER = "user";
	public static final String SESSION_USER_JSON = "user_json";
	public static final String COOKIE_NAME="Z_USER";
	public static final int TYPE_ADMIN = 1;
	public static final int TYPE_COMMON = 0;
	private boolean fromMobile;
	private String username;
	private String password;
	private String passwordMD5;
	private String nickname;
	private String email;
	private String registIp;
	private int type;

	public User() {
		super();
	}

	public User(String username, String password, String nickname) {
		super();
		this.username = username;
		this.password = password;
		this.nickname = nickname;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getRegistIp() {
		return registIp;
	}

	public void setRegistIp(String registIp) {
		this.registIp = registIp;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public boolean isFromMobile() {
		return fromMobile;
	}

	public void setFromMobile(boolean isFromMobile) {
		this.fromMobile = isFromMobile;
	}

	public boolean isAdmin() {
		return type == TYPE_ADMIN;
	}

	public String getPasswordMD5() {
		return passwordMD5;
	}

	public void setPasswordMD5(String passwordMD5) {
		this.passwordMD5 = passwordMD5;
	}

	@Override
	public String toString() {
		return "User [ username=" + username + ", nickname=" + nickname + ", registIp=" + registIp + ",fromMobile=" + fromMobile + "]";
	}

}
